<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px" inline style="margin-top: 50px">
      <el-form-item label="名称">
        <el-input style="width: 180px" placeholder="请输入" />
      </el-form-item>
      <el-form-item label="状态">
        <el-select v-model="form.region" placeholder="请选择活动区域">
          <el-option label="发布" value="1" />
          <el-option label="隐藏" value="2" />
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">课程筛选</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="addDialogVisible=true">课程添加</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      style="width: 95%;margin-left: 30px"
      border
    >
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-form label-position="left" inline class="demo-table-expand">
            <el-form-item label="名称" style="display: block">
              <span>{{ props.row.name }}</span>
            </el-form-item>
            <el-form-item label="描述" style="display: block">
              <span>{{ temp.text }}</span>
            </el-form-item>
            <el-form-item label="单价" style="display: block">
              <span>{{ temp.price }}</span>
            </el-form-item>
            <el-form-item label="总销售数量" style="display: block">
              <span>{{ props.row.address }}</span>
            </el-form-item>
          </el-form>
        </template>
      </el-table-column>
      <el-table-column
        prop="name"
        label="名称"
        width="180"
      />
      <el-table-column
        prop="address"
        label="总销售数量"
      />
      <el-table-column
        label="操作"
        width="180"
      >
        <template slot-scope="scope">
          <el-button type="text" @click="centerDialogVisible=true">发布</el-button>
          <el-button type="text" @click="centerDialogVisible=true">隐藏</el-button>
          <el-button type="text" @click="handleClick(scope.row)">编辑</el-button>
          <el-button type="text">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-dialog
      :visible.sync="centerDialogVisible"
      title="课程详情"
      left
    >
      <el-form :model="form">
        <el-form-item label="名称" label-width="100px">
          <!--          <el-input v-model="form.name" autocomplete="off" readonly width="120px"></el-input>-->
          {{ form.name }}
        </el-form-item>
        <el-form-item label="描述" label-width="100px" readonly>
          <!--          <el-input v-model="form.text" autocomplete="off" width="150px" readonly />-->
          {{ form.text }}
        </el-form-item>
        <el-form-item label="单价" label-width="100px" readonly>
          <!--          <el-input v-model="form.price" autocomplete="off" width="150px" readonly />-->
          {{ form.price }}
        </el-form-item>
        <el-form-item label="总销售数量" label-width="100px" readonly>
          <!--          <el-input v-model="form.num" autocomplete="off" width="150px" readonly />-->
          {{ form.num }}
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="centerDialogVisible = false">确定</el-button>
      </span>
    </el-dialog>

    <!--    课程添加功能-->
    <el-dialog
      :visible.sync="addDialogVisible"
      title="课程添加"
      left
      width="30%"
    >
      <el-form :model="form">
        <el-form-item label="名称" label-width="100px">
          <el-input v-model="form.addname" style="width: 80%" />
        </el-form-item>
        <el-form-item label="描述" label-width="100px">
          <el-input v-model="form.addtext" style="width: 80%" />
        </el-form-item>
        <el-form-item label="单价" label-width="100px">
          <el-input v-model="form.addprice" style="width: 80%" />
        </el-form-item>
        <el-form-item label="师资" label-width="100px">
          <el-input v-model="form.addteacher" style="width: 80%" />
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="addDialogVisible = false">添加</el-button>
        <el-button @click="addDialogVisible = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>

export default {
  name: 'KeyboardChart',
  data() {
    return {
      centerDialogVisible: false,
      addDialogVisible: false,
      form: {
        region: '1',
        name: '拉拉啦',
        addname: '',
        addnum: '',
        addprice: '',
        addtext: '',
        addteacher: '',
        num: '100',
        price: '100',
        text: '好东西',
        teacher: ''
      },
      tableData: [{
        name: 'vue',
        address: '1000'
      }, {
        name: '大彩电',
        address: '2040'
      }, {
        name: '小老虎',
        address: '1'
      }, {
        name: '0.0',
        address: '222'
      }]
    }
  }
}
</script>

<style scoped>
</style>

